/**══════════════════════════════════╗
*作    者：songbaobao                                                 ║
*职    业：我以我血荐轩辕                                              ║                                              
*CSND地址：https://blog.csdn.net/weixin_43949535                       ║
**GitHub ：https://github.com/TsinghuaLucky912/My_own_C-_study_and_blog║
*═══════════════════════════════════╣
*创建时间：                                                           
*功能描述：                                                            
*                                                                      
*                                                                      
*═══════════════════════════════════╣
*结束时间:                                                           
*═══════════════════════════════════╝
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//              西南\./联大               \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
*/
#include <iostream>
#include <vector>
#include <string.h>
#include <unordered_map>
#include <ctype.h>
#include <queue>
#include <list>
#include <map>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

#if A
struct person {
	char name[20];
	int count;
}leader[3] = { "Li", 0, "Zhang", 0, "Fun", 0 };
#endif

#if B
struct student {
	int num;
	char name[20];
	char sex;
	int age;
};
#endif

#if C
struct Person {
	int num;
	char name[10];
	char sex;
	char job;
	union {
		int class1;
		char position[10];
	}category;
};
#endif

#if D
struct student {
	int num;
	char name[20];
	int math;
	int Chinese;
	int English;
};

void input(student* p, int n)
{
	for (int i = 0; i < n; ++i)
	{
		cin >> p[i].num >> p[i].name >> p[i].math >> p[i].Chinese >> p[i].English;
	}
}
	
void print(student* p, int n)
{
	for (int i = 0; i < n; ++i)
	{
		cout << p[i].num << " " << p[i].name << " " << p[i].math << " " << p[i].Chinese << " " << p[i].English << endl;
	}
}
#endif

#if E
struct student {
	int num;
	char name[20];
	int math;
	int Chinese;
	int English;
	double average;
};

void input(student* p, int n, int& totalCh, int& totalEn, int& totalMa)
{
	for (int i = 0; i < n; ++i)
	{
		cin >> p[i].num >> p[i].name >> p[i].math >> p[i].Chinese >> p[i].English;
		p[i].average = ((double)(p[i].Chinese) + (double)(p[i].English) + (double)(p[i].math)) / 3.0;

		totalMa += p[i].math;
		totalCh += p[i].Chinese;
		totalEn += p[i].English;
	}
}
#endif

int main()
{
#if A
	int n = 0;
	cin >> n;
	char str[10] = { 0 };
	while (n-- != -1)
	{
		cin.getline(str, 10);
		if (strcmp(leader[0].name, str) == 0)
			leader[0].count++;
		if (strcmp(leader[1].name, str) == 0)
			leader[1].count++;
		if (strcmp(leader[2].name, str) == 0)
			leader[2].count++;
	}
	for (int i = 0; i < 3; ++i)
	{
		cout << leader[i].name << ":" << leader[i].count << endl;
	}
#endif

#if B
	int n;
	cin >> n;

	student stuArray[20], * p = stuArray;

	for (int i = 0; i < n; ++i)
	{
		cin >> p[i].num >> p[i].name >> p[i].sex >> p[i].age;
	}
	for (int i = 0; i < n; ++i)
	{
		cout << p[i].num << " " << p[i].name << " " << p[i].sex << " " << p[i].age << endl;
	}
#endif

#if C
	int n;
	cin >> n;

	Person perArray[100], * p = perArray;

	for (int i = 0; i < n; ++i)
	{
		cin >> p[i].num >> p[i].name >> p[i].sex >> p[i].job;
		if (p[i].job == 's')
			cin >> p[i].category.class1;
		else
			cin >> p[i].category.position;
	}
	for (int i = 0; i < n; ++i)
	{
		cout << p[i].num << " " << p[i].name << " " << p[i].sex << " " << p[i].job << " ";
		if (p[i].job == 's')
			cout << p[i].category.class1 << endl;
		else
			cout << p[i].category.position << endl;
	}
#endif

#if D
	int n = 5;

	student stuArray[20], * p = stuArray;

	input(p, n);
	print(p, n);
#endif

#if E
	int n = 10, maxIndex = 0, totalCh = 0, totalEn = 0, totalMa = 0;
	student stuArray[20], * p = stuArray;

	input(p, n, totalCh, totalEn, totalMa);

	cout << setiosflags(ios::fixed) << setprecision(2) << (double)totalMa / 10.0 << " "
		<< setprecision(2) << (double)totalCh / 10.0 << " " << setprecision(2) << (double)totalEn / 10.0 << endl;
	for (int i = 1; i < n; ++i)
	{
		if (p[i].average > p[maxIndex].average)
			maxIndex = i;
	}
	cout << p[maxIndex].num << " " << p[maxIndex].name << " " << p[maxIndex].math
		<< " " << p[maxIndex].Chinese << " " << p[maxIndex].English << endl;
#endif
	return 0;
}
/**
*备用注释：
*
*
*
*/